rmarkdown::render(‘./1_JP_scripts/2_MBP-clustering_HARDAC.Rmd’)
Changes in myeloid and kidney cells after CLP - Analysis of 2 x 10X scRNA-seq samples from 2 pools of WT mice (3 Sham + 3 CLP): comparison of gene expression in different cell populations
indir <- "./processedData/1_JP_analyses_results/Rerun_HARDAC_20210216/1_QC_filtering_metrics"
outdir <- "./processedData/1_JP_analyses_results/Rerun_HARDAC_20210216/2_MBP-clustering"
dir.create(outdir, recursive = T)
library(Seurat)
filtered <- readRDS(paste0(indir, "/15.filtered.398.rds"))
filtered
## An object of class Seurat
## 22399 features across 18055 samples within 1 assay
## Active assay: RNA (22399 features, 0 variable features)
Normalize each sample individually and selected 2000 most variable genes between samples
library(cowplot)
list <- SplitObject(filtered, split.by = "sample.id")
list <- lapply(X = list, FUN = function(x) {
x <- NormalizeData(x)
x <- FindVariableFeatures(x, selection.method = "vst", nfeatures = 2000)
})
anchors <- FindIntegrationAnchors(object.list = list, dims = 1:20)
integrated <- IntegrateData(anchorset = anchors, dims = 1:20)
DefaultAssay(integrated) <- "integrated"
integrated <- ScaleData(integrated, verbose = T)
integrated
## An object of class Seurat
## 24399 features across 18055 samples within 2 assays
## Active assay: integrated (2000 features, 2000 variable features)
## 1 other assay present: RNA
DefaultAssay(integrated) <- "integrated"
integrated <- RunPCA(integrated, npcs = 30, verbose = FALSE)
integrated <- RunUMAP(integrated, reduction = "pca", dims = 1:10)
integrated <- FindNeighbors(integrated, reduction = "pca", dims = 1:10)
integrated <- FindClusters(integrated, resolution = 0.25)
## Modularity Optimizer version 1.3.0 by Ludo Waltman and Nees Jan van Eck
##
## Number of nodes: 18055
## Number of edges: 616749
##
## Running Louvain algorithm...
## Maximum modularity in 10 random starts: 0.9527
## Number of communities: 15
## Elapsed time: 2 seconds
d <- DimPlot(integrated, reduction = "umap", pt.size = 0.2, label = T,
label.size = 6)
d
pdf(paste0(outdir, "/5_DimPlot_umap_clusters_pc10_res0_25.pdf"),
width = 10, height = 8)
d
dev.off()
## png
## 2
p1 <- DimPlot(integrated, reduction = "umap", group.by = "sample.id",
pt.size = 0.2)
p2 <- DimPlot(integrated, reduction = "umap", label = TRUE, pt.size = 0.2,
label.size = 6, )
plot_grid(p1, p2)
pdf(paste0(outdir, "/6_2DimPlots_umap_samples_clusters_pc10_res0_25.pdf"),
width = 18, height = 8)
plot_grid(p1, p2)
dev.off()
## png
## 2
p1 <- DimPlot(integrated, reduction = "umap", group.by = "sample.id")
p2 <- DimPlot(integrated, reduction = "umap", label = TRUE)
plot_grid(p1, p2)
d <- DimPlot(integrated, reduction = "umap", group.by = "sample.id",
split.by = "sample.id", pt.size = 0.2, ncol = 2)
d
pdf(paste0(outdir, "/7_DimPlot_umap_split_by_samples.pdf"), width = 16,
height = 9)
d
dev.off()
## png
## 2
f <- FeaturePlot(integrated, features = c("Nphs2", "Slc5a2",
"Clcnka", "Slc12a1", "Ptgs2", "Slc12a3", "Calb1", "Aqp2",
"Slc4a1", "Slc26a4", "Slc14a2", "Upk1a", "Cd22", "Adgre1",
"Pecam1", "Pdgfrb", "Cd68", "Cd14", "Acta2", "Csf3r", "Cd4"),
min.cutoff = "q9")
f
pdf(paste0(outdir, "/8_FeaturePlot_cellID.pdf"), width = 10,
height = 8)
f
dev.off()
## png
## 2
##Annotation of markers based on cluster markers from Susztak Science paper (Park et al., Science 360, 758–763 (2018) and Kidney International (2019) 95, 787–796; https://doi.org/10.1016/
#Podocyte markers
f2 <- FeaturePlot(integrated, features = c("Nphs2", "Podxl"),
min.cutoff = "q9")
f2
pdf(paste0(outdir, "/9_FeaturePlot_Podo.pdf"), width = 10, height = 8)
f2
dev.off()
## png
## 2
#Endothelial markers
f3 <- FeaturePlot(integrated, features = c("Plat", "Pecam1"),
min.cutoff = "q9")
f3
pdf(paste0(outdir, "/10_FeaturePlot_Endo.pdf"), width = 10, height = 8)
f3
dev.off()
## png
## 2
#PT-S1 markers
f4 <- FeaturePlot(integrated, features = c("Slc5a2", "Slc5a12"),
min.cutoff = "q9")
f4
pdf(paste0(outdir, "/11_FeaturePlot_PTs1.pdf"), width = 10, height = 8)
f4
dev.off()
## png
## 2
#PT-S2 markers
f5 <- FeaturePlot(integrated, features = c("Fxyd2", "Hrsp12"),
min.cutoff = "q9")
f5
pdf(paste0(outdir, "/12_FeaturePlot_PTs2.pdf"), width = 10, height = 8)
f5
dev.off()
## png
## 2
#PT-S3 markers
f6 <- FeaturePlot(integrated, features = c("Atp11a", "Slc13a3"),
min.cutoff = "q9")
f6
pdf(paste0(outdir, "/13_FeaturePlot_PTs3.pdf"), width = 10, height = 8)
f6
dev.off()
## png
## 2
#Loop of Henle
f7 <- FeaturePlot(integrated, features = c("Slc12a1", "Umod"),
min.cutoff = "q9")
f7
pdf(paste0(outdir, "/14_FeaturePlot_LOH.pdf"), width = 10, height = 8)
f7
dev.off()
## png
## 2
#Distal CT
f8 <- FeaturePlot(integrated, features = c("Slc12a3", "Pvalb"),
min.cutoff = "q9")
f8
pdf(paste0(outdir, "/15_FeaturePlot_DCT.pdf"), width = 10, height = 8)
f8
dev.off()
## png
## 2
#Conn Tubule
f21 <- FeaturePlot(integrated, features = c("Calb1"), min.cutoff = "q9")
f21
pdf(paste0(outdir, "/29_FeaturePlot_ConnTub.pdf"), width = 10,
height = 8)
f21
dev.off()
## png
## 2
#CD PC
f9 <- FeaturePlot(integrated, features = c("Aqp2", "Hsd11b2"),
min.cutoff = "q9")
f9
pdf(paste0(outdir, "/16_FeaturePlot_CD-PC.pdf"), width = 10,
height = 8)
f9
dev.off()
## png
## 2
#CD-IC
f10 <- FeaturePlot(integrated, features = c("Atp6v1g3", "Atp6v0d2"),
min.cutoff = "q9")
f10
pdf(paste0(outdir, "/17_FeaturePlot_CD-IC.pdf"), width = 10,
height = 8)
f10
dev.off()
## png
## 2
#CD Trans
f11 <- FeaturePlot(integrated, features = c("Slc26a4", "Insrr",
"Rhbg"), min.cutoff = "q9")
f11
pdf(paste0(outdir, "/18_FeaturePlot_CD-Trans.pdf"), width = 10,
height = 8)
f11
dev.off()
## png
## 2
#Fibroblast
f12 <- FeaturePlot(integrated, features = c("Plac8", "S100a4",
"Pdgfrb"), min.cutoff = "q9")
f12
pdf(paste0(outdir, "/19_FeaturePlot_Fib.pdf"), width = 10, height = 8)
f12
dev.off()
## png
## 2
#Macro
f13 <- FeaturePlot(integrated, features = c("C1qa", "Cd68", "C1qb"),
min.cutoff = "q9")
f13
pdf(paste0(outdir, "/20_FeaturePlot_Macro.pdf"), width = 10,
height = 8)
f13
dev.off()
## png
## 2
#PMN
f14 <- FeaturePlot(integrated, features = c("S100a8", "Ly6g",
"S100a9"), min.cutoff = "q9")
f14
pdf(paste0(outdir, "/21_FeaturePlot_PMN.pdf"), width = 10, height = 8)
f14
dev.off()
## png
## 2
#B lymph
f15 <- FeaturePlot(integrated, features = c("Cd79a", "Cd79b",
"Cd19"), min.cutoff = "q9")
f15
pdf(paste0(outdir, "/22_FeaturePlot_Blymph.pdf"), width = 10,
height = 8)
f15
dev.off()
## png
## 2
#Tlymph
f16 <- FeaturePlot(integrated, features = c("Ltb", "Cd4", "Cxcr6"),
min.cutoff = "q9")
f16
pdf(paste0(outdir, "/23_FeaturePlot_Tlymph.pdf"), width = 10,
height = 8)
f16
dev.off()
## png
## 2
#NK
f17 <- FeaturePlot(integrated, features = c("Gzma", "Nkg7"),
min.cutoff = "q9")
f17
pdf(paste0(outdir, "/24_FeaturePlot_NK.pdf"), width = 10, height = 8)
f17
dev.off()
## png
## 2
#Novel1
f18 <- FeaturePlot(integrated, features = c("Slc27a2", "Lrp2",
"Cdca3"), min.cutoff = "q9")
f18
pdf(paste0(outdir, "/25_FeaturePlot_Novel1.pdf"), width = 10,
height = 8)
f18
dev.off()
## png
## 2
# library(Seurat)
DefaultAssay(integrated) <- "RNA"
clusters <- levels(integrated@active.ident)
conserved.markers <- data.frame(matrix(ncol = 14))
for (c in clusters) {
print(c)
markers.c <- FindConservedMarkers(integrated, ident.1 = c,
grouping.var = "sample.id", verbose = T)
markers.c <- cbind(data.frame(cluster = rep(c, dim(markers.c)[1]),
gene = rownames(markers.c)), markers.c)
write.table(markers.c, file = paste0(outdir, "/11_markers_",
c, ".txt"))
colnames(conserved.markers) <- colnames(markers.c)
conserved.markers <- rbind(conserved.markers, markers.c)
head(conserved.markers)
}
## [1] "0"
## [1] "1"
## [1] "2"
## [1] "3"
## [1] "4"
## [1] "5"
## [1] "6"
## [1] "7"
## [1] "8"
## [1] "9"
## [1] "10"
## [1] "11"
## [1] "12"
## [1] "13"
## [1] "14"
conserved.markers <- conserved.markers[-1, ]
write.table(conserved.markers, file = paste0(outdir, "/12_conserved.markers.tsv"),
quote = T, sep = "\t", col.names = NA)
saveRDS(conserved.markers, paste0(outdir, "/12.conserved.markers.rds"))
# conserved.markers <-
# readRDS('./2_MBP-clustering/12.conserved.markers.rds')
integrated <- RenameIdents(integrated, `0` = "PT-s3", `1` = "PT-s1",
`2` = "PT-s2", `3` = "Endo", `4` = "CT", `5` = "PT-s3", `6` = "LOH",
`7` = "Fib", `8` = "DCT", `9` = "CD-PC", `10` = "Macro",
`11` = "CD-IC", `12` = "Lympho", `13` = "Novel", `14` = "Podo",
`15` = "PMN")
d2 <- DimPlot(integrated, label = TRUE, label.size = 8)
d2
pdf(paste0(outdir, "/32_Dimplot_newidents.pdf"))
d2
dev.off()
## png
## 2
d3 <- DimPlot(integrated, group.by = "sample.id", split.by = "sample.id",
pt.size = 0.2, ncol = 2)
d3
pdf(paste0(outdir, "/31_DimPlot_newidents_split_by_samples.pdf"),
width = 16, height = 9)
d3
dev.off()
## png
## 2
DefaultAssay(integrated) <- "RNA"
f19 <- FeaturePlot(integrated, features = "Il6", order = T, label = T,
label.size = 6)
f19
pdf(paste0(outdir, "/26_FeaturePlot_Il6.pdf"))
f19
dev.off()
## png
## 2
f20 <- FeaturePlot(integrated, features = c("Il6"), split.by = "sample.id",
max.cutoff = 3, cols = c("grey", "red"))
f20
pdf(paste0(outdir, "/27_FeaturePlot_Il6-sham-CLP.pdf"))
f20
dev.off()
## png
## 2
library(ggplot2)
library(cowplot)
theme_set(theme_cowplot())
integrated$celltype.stim <- paste(Idents(integrated), integrated$sample.id,
sep = "_")
integrated$celltype <- Idents(integrated)
Idents(integrated) <- "celltype"
plots <- VlnPlot(integrated, features = c("Il6"), split.by = "sample.id",
group.by = "celltype", pt.size = 0, combine = FALSE)
library(patchwork)
wrap_plots(plots = plots, ncol = 1)
sessionInfo()
## R version 4.0.3 (2020-10-10)
## Platform: x86_64-conda-linux-gnu (64-bit)
## Running under: Red Hat Enterprise Linux Server release 6.8 (Santiago)
##
## Matrix products: default
## BLAS: /gpfs/fs1/data/omicscore/Privratsky-Privratsky-20210215/scripts/conda/envs/privratsky/lib/libblas.so.3.8.0
## LAPACK: /gpfs/fs1/data/omicscore/Privratsky-Privratsky-20210215/scripts/conda/envs/privratsky/lib/liblapack.so.3.8.0
##
## locale:
## [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
## [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
## [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
## [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
## [9] LC_ADDRESS=C LC_TELEPHONE=C
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] ggplot2_3.3.3 cowplot_1.1.1 SeuratObject_4.0.0 Seurat_4.0.0
## [5] patchwork_1.1.1
##
## loaded via a namespace (and not attached):
## [1] nlme_3.1-152 matrixStats_0.58.0 RcppAnnoy_0.0.18
## [4] RColorBrewer_1.1-2 httr_1.4.2 sctransform_0.3.2
## [7] tools_4.0.3 R6_2.5.0 irlba_2.3.3
## [10] rpart_4.1-15 KernSmooth_2.23-18 uwot_0.1.10
## [13] mgcv_1.8-33 lazyeval_0.2.2 colorspace_2.0-0
## [16] withr_2.4.1 tidyselect_1.1.0 gridExtra_2.3
## [19] compiler_4.0.3 formatR_1.7 plotly_4.9.3
## [22] labeling_0.4.2 scales_1.1.1 lmtest_0.9-38
## [25] spatstat.data_2.0-0 ggridges_0.5.3 pbapply_1.4-3
## [28] spatstat_1.64-1 goftest_1.2-2 stringr_1.4.0
## [31] digest_0.6.27 spatstat.utils_2.0-0 rmarkdown_2.6
## [34] pkgconfig_2.0.3 htmltools_0.5.1.1 parallelly_1.23.0
## [37] limma_3.46.0 highr_0.8 fastmap_1.1.0
## [40] htmlwidgets_1.5.3 rlang_0.4.10 shiny_1.6.0
## [43] farver_2.0.3 generics_0.1.0 zoo_1.8-8
## [46] jsonlite_1.7.2 ica_1.0-2 dplyr_1.0.4
## [49] magrittr_2.0.1 Matrix_1.3-2 Rcpp_1.0.6
## [52] munsell_0.5.0 abind_1.4-5 reticulate_1.18
## [55] lifecycle_1.0.0 stringi_1.5.3 yaml_2.2.1
## [58] gbRd_0.4-11 MASS_7.3-53.1 Rtsne_0.15
## [61] plyr_1.8.6 grid_4.0.3 parallel_4.0.3
## [64] listenv_0.8.0 promises_1.2.0.1 ggrepel_0.9.1
## [67] crayon_1.4.1 deldir_0.2-9 miniUI_0.1.1.1
## [70] lattice_0.20-41 splines_4.0.3 tensor_1.5
## [73] knitr_1.31 pillar_1.4.7 igraph_1.2.6
## [76] future.apply_1.7.0 reshape2_1.4.4 codetools_0.2-18
## [79] leiden_0.3.7 glue_1.4.2 evaluate_0.14
## [82] metap_1.1 data.table_1.13.6 Rdpack_2.1
## [85] vctrs_0.3.6 png_0.1-7 httpuv_1.5.5
## [88] gtable_0.3.0 RANN_2.6.1 purrr_0.3.4
## [91] polyclip_1.10-0 tidyr_1.1.2 scattermore_0.7
## [94] future_1.21.0 xfun_0.20 rbibutils_2.0
## [97] mime_0.10 xtable_1.8-4 RSpectra_0.16-0
## [100] later_1.1.0.1 survival_3.2-7 viridisLite_0.3.0
## [103] tibble_3.0.6 cluster_2.1.1 globals_0.14.0
## [106] fitdistrplus_1.1-3 ellipsis_0.3.1 ROCR_1.0-11
writeLines(capture.output(sessionInfo()), "./scripts/1_JP_scripts/2_MBP-clustering_HARDAC.sessionInfo.txt")